import 'package:flutter/material.dart';
import 'package:wheel_of_fortune/candy/widgets/counter.dart';
import 'package:wheel_of_fortune/utils/utils.dart';
import 'package:wheel_of_fortune/widgets/customer_button.dart';


class RedeemSpin extends StatefulWidget {
  /// 0- Spin using Candy  1- Purchase Spin
  final type;
  RedeemSpin({this.type=0,Key key}) : super(key: key);

  @override
  _RedeemOrBuyCandyState createState() => _RedeemOrBuyCandyState();
}

class _RedeemOrBuyCandyState extends State<RedeemSpin> {
  int _count = 1;
  @override
  Widget build(BuildContext context) {
    return Container(
      color: whiteColor,
      child: SingleChildScrollView(
        child: Column(
          // crossAxisAlignment: CrossAxisAlignment.end,
          children: [
            Container(
              child: Image.asset('assets/images/${widget.type==0?'FortuneWheel_ExchangeIcon_Candy.jpg':'FortuneWheel_ExchangeIcon_Peso.jpg'}',),
            ),
            widget.type == 0?
            Column(
              children: [
                Padding(
                  padding: EdgeInsets.fromLTRB(0, 25, 0, 0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        'Candy Balance',
                        style: TextStyle(
                          color: mainColor,
                          fontSize: 26,
                          fontFamily: 'Avenir Next LT Pro',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(width: 5,),
                      // Expanded(
                      //   child: 
                      // ),
                      Text(
                        '9999',
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: yellowColor,
                          fontSize: 26,
                          fontFamily: 'Avenir Next LT Pro',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ],
                  ),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(27, 15, 27, 10),
                  child: Text(
                    "Exchange 10 candies for 1 spin!",
                    style: TextStyle(
                      color: mainColor,
                      fontSize: 14,
                      fontFamily: 'Avenir Next LT Pro',
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                ),
              ],
            )
            :Column(
              children: [
                Padding(
                  padding: EdgeInsets.fromLTRB(0, 25, 0, 0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        '9999',
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: yellowColor,
                          fontSize: 27,
                          fontFamily: 'Avenir Next LT Pro',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(width: 10,),
                      Text(
                        'pesos',
                        style: TextStyle(
                          color: mainColor,
                          fontSize: 27,
                          fontFamily: 'Avenir Next LT Pro',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ],
                  ),
                ),
                Padding(
                  padding: EdgeInsets.fromLTRB(27, 15, 27, 10),
                  child: Text(
                    "Exchange 1 pesos for 1 spin.",
                    style: TextStyle(
                      color: mainColor,
                      fontSize: 14,
                      fontFamily: 'Avenir Next LT Pro',
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                ),
              ],
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(66, 16, 66, 0),
              child: Counter(
                callBack: (count) {
                  setState(() {
                    _count = count;
                  });
                },
              ),
            ),
            Padding(
              padding: EdgeInsets.only(top: 60,bottom: 20),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  BgButton(
                    title: 'Redeem',
                    width: 200.0,
                    color: deepYellowColor,
                    onTap: (){},
                  ),
                  SizedBox(
                    height: 15,
                  ),
                  InkWell(
                    onTap: () => Navigator.of(context).pop(false),
                    child: Text(
                      'Cancel',
                      style: TextStyle(
                        color: greyDBColor,
                        fontSize: 16,
                        fontFamily: 'Avenir Next LT Pro',
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
